﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CIT.Helper.PaginatedList<DTO.Models.MEDIA>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	cit.com.vn - Trang Tim kiem
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="dung-maincontent-show">
        <div class="dung-section">
            <div class="dung-section-border"></div>
            <div class="dung-section-title">
                Kết quả tìm kiếm với từ khóa <b><%=ViewData["SearchText"]%></b> : <b><%=ViewData["ResultCount"] %></b> kết quả
            </div>
            <div class="dung-section-content">
                <div class="dung-item-search"> 
                <ul>
                <% foreach (var item in Model)
                   { %>
                   <% string controllerName = string.Empty;
                      if (item.TypeMediaName.Contains("thongtin"))
                          controllerName = "Thongtin";
                      else if (item.TypeMediaName.Contains("tuvan"))
                          controllerName = "Tuvan";
                      else if (item.TypeMediaName.Contains("hoatdong"))
                          controllerName = "Hoatdong";
                      else if (item.TypeMediaName.Contains("daotao"))
                          controllerName = "Daotao";
                      else if (item.TypeMediaName.Contains("sukien"))
                          controllerName = "Sukien";
                       %>
                    <li style="margin:0; padding:3px 0; border-bottom: dotted 1px #CCC;background: none" >
                        <a href='<%= Url.Action("Detail", controllerName, new { id = item.MediaID, typeMediaName = item.TypeMediaName, pageIndex = 1 })%>'>
                            <%= item.Title%>
                        </a>
                    </li>
                <%} %>
                </ul>      
                </div>
                <br />
                <div class="dung-text-right" >
                    <b>Trang : </b> 
                        <% 
                            for (int j = Model.PageIndex - 3; j < Model.PageIndex + 6; j++)
                                if (j > 0 && j <= Model.TotalPages)
                                {
                                    if (j != Model.PageIndex + 1)
                                        Response.Write(Html.ActionLink(j.ToString(), "Index", "Search", new
                                        {
                                            id = ViewData["SearchText"],
                                            page = j-1
                                        }));
                                    else
                                        Response.Write(j.ToString());

                                    if (j < Model.TotalPages)
                                        Response.Write("&nbsp;|&nbsp;");
                                }
                        %>
                </div>     
            </div>
        </div>
    </div>
</asp:Content>
